//
//  bindingFooterView.m
//  EasyToTesco2.0
//
//  Created by 袖手旁觀 on 16/6/16.
//  Copyright © 2016年 EasyToTesco. All rights reserved.
//

#import "bindingFooterView.h"

@implementation bindingFooterView

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
    
        [self loadBindingFooterView];
    }
    
    return self;
}

- (void)loadBindingFooterView {
    UIButton *button = [[UIButton alloc] init];
    [button setBackgroundColor:DEFAULT_COLOR];
    button.layer.cornerRadius = 5;
    button.layer.masksToBounds = YES;
    [button setTitle:@"确认" forState:UIControlStateNormal];
    button.titleLabel.font = FONT(15);
    [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [button addTarget:self action:@selector(didClickQueDingButton:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:button];
    
    [button mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.mas_centerX);
        make.height.mas_equalTo(self.Height/4);
        make.width.mas_equalTo(WIDTH - 30);
        make.top.equalTo(self.mas_top).with.offset(self.Height/5);
    }];
}

- (void)didClickQueDingButton:(UIButton *)button {
    if ([self.delegaete respondsToSelector:@selector(didClickConfirmButton:)]) {
        [self.delegaete didClickConfirmButton:button];
    }
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    
    if ([self.delegaete respondsToSelector:@selector(didClickViewClearTextField)]) {
        [self.delegaete didClickViewClearTextField];
    }
}


@end
